/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package threads;

import java.util.concurrent.BlockingQueue;

/**
 *
 * @author Bertil
 */
public class Prod125 implements Runnable{
public Thread activity = new Thread(this);
    private String text;
    private long interval;
    private BlockingQueue<String> q;

    public Prod125(String txt, long time, BlockingQueue<String> k){
        text = txt;
        interval = time*1000;
        q = k;
    }
    public void run(){
        while(XThread.delay(interval)){
            try{
                q.put(text);
            }
            catch(InterruptedException e){
                System.out.println("Heartbeat failed");
            }
        }
    }
}
